<template>
  <div>
    <el-container>
      <el-header>待退保订单</el-header>
      <el-main>
        <el-table :data="orderslist" border style="width: 100%">
          <el-table-column fixed prop="_id" label="订单编号"> </el-table-column>
          <el-table-column prop="insuresId" label="投保产品"> </el-table-column>
          <el-table-column prop="usersId" label="客户"> </el-table-column>
          <el-table-column prop="phone" label="联系方式"> </el-table-column>
          <el-table-column prop="cancelState" label="处理进度">
          </el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button plain @click="open(scope.row)">确认退保</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-main>
      <el-footer>
        <div class="block">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-sizes="[5, 10, 15]"
            :page-size="5"
            layout="total, sizes, prev, pager, next, jumper"
            :total="20"
          >
          </el-pagination>
        </div>
      </el-footer>
    </el-container>
  </div>
</template>

<script>
import { createNamespacedHelpers } from "vuex";
const { mapState, mapActions, mapMutations } = createNamespacedHelpers(
  "orders"
);
export default {
  created() {
    this.getCancelOrders();
  },
  methods: {
    ...mapActions(["cancelOrders", "getCancelOrders"]),
    ...mapMutations(["searchCancelOrders", "changecancelState"]),
    open(row) {
      this.cancelOrders({cancelState:3,_id:row._id});
      const h = this.$createElement;
      this.$notify({
        message: h("i", { style: "color: teal" }, "退保处理成功"),
      });
    },
    handleSizeChange(val) {},
    handleCurrentChange(val) {},
  },
  computed: {
    ...mapState(["orderslist"]),
  },
  data() {
    return {
      currentPage: 1,
    };
  },
};
</script>

<style>
.el-footer {
  line-height: 60px;
}
.block {
  height: 60px;
  line-height: 60px;
}
.el-main {
  padding: 0px;
}
.el-header,
.el-footer {
  padding: 0 20px;
  line-height: 60px;
}
.cell {
  text-align: center;
}
</style>